The Backend module supports automatic agent ID detection from environment variables, eliminating the need to explicitly provide the agent ID in many scenarios.
import osfrom xpander_sdk import Backend# Set the environment variableos.environ["XPANDER_AGENT_ID"] = "agent-123"backend = Backend()# No need to specify agent_id - it will be auto-detectedargs = await backend.aget_args()print(f"Arguments resolved for agent: {args}")
Note: If both an environment variable and explicit parameters are provided, the explicit parameters take precedence.
The Backend Module provides comprehensive functionality for retrieving agent runtime arguments for execution within the xpander.ai platform. This module supports multiple AI frameworks and dispatches agent arguments accordingly.
from xpander_sdk import Backendbackend = Backend()# Resolve arguments by agent IDargs = await backend.aget_args(agent_id="agent-123")print(f"Resolved arguments: {args}")# Use resolved arguments with your framework# For example, with Agno framework:from agno import Agent as AgnoAgentagent = AgnoAgent(**args)
from xpander_sdk import Backendbackend = Backend()# Resolve arguments by agent IDargs = backend.get_args(agent_id="agent-123")print(f"Resolved arguments: {args}")# Use resolved arguments with your frameworkfrom agno import Agent as AgnoAgentagent = AgnoAgent(**args)
from xpander_sdk import Backendfrom agno import Agent as AgnoAgentbackend = Backend()# Resolve arguments for Agno framework agentargs = await backend.aget_args(agent_id="agno-agent-123")# Create Agno agent with resolved argumentsagno_agent = AgnoAgent(**args)# Run the agentresponse = agno_agent.run("What's the weather like today?")print(response.content)
Continue to the [Backend API Reference] for detailed documentation on classes and methods.